/*
 * Copyright Notice ====================================================
 * This file contains proprietary information of Hewlett-Packard Co.
 * Copying or reproduction without prior written approval is prohibited.
 * Copyright (c) 2013 All rights reserved. =============================
 */

package com.hp.ecs.sonar.util;

import org.sonar.api.rules.RulePriority;

public class Violation {

	private String file;

	private Integer line;

	private String time;

	private String message;

	private String content;

	private RulePriority level;

	private Integer snapshotId;

	public String getFile() {
		return file;
	}

	public Integer getLine() {
		return line;
	}

	public String getTime() {
		return time;
	}

	public String getMessage() {
		return message;
	}

	public String getContent() {
		return content;
	}

	public RulePriority getLevel() {
		return level;
	}

	public void setFile(String file) {
		this.file = file;
	}

	public void setLine(Integer line) {
		this.line = line;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public void setLevel(RulePriority level) {
		this.level = level;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getLevel()).append(':').append(getMessage()).append('\n');
		sb.append(getTime()).append(' ').append(getFile()).append(':');
		if (getContent() != null) {
			sb.append(getLine()).append('\n').append(getContent());
		}
		return sb.toString();
	}

	public void setSnapshotId(Integer snapshotId) {
		this.snapshotId = snapshotId;
	}

	public Integer getSnapshotId() {
		return snapshotId;
	}
}
